<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>绑定事件并传参</title>
</head>
<body>
  <div id="app">
    <p>count的值为 {{count}}</p>
    <button @click="addCount(2,$event)">+2</button>
  </div>
  <script src="./lib/vue-2.6.12.js"></script>
  <script>
    const vm=new Vue({
      el:'#app',
      data:{
        count:0
      },
      methods: {
        addCount(step,e){
          const BgColor=e.target.style.background
          e.target.style.background=BgColor==='red'?'':'red'
          this.count+=step
        }
      },
    })
  </script>
</body>
</html>